//
//  XHMyCollectionViewCell.m
//  Big Show
//
//  Created by 赵晓航 on 15-5-13.
//  Copyright (c) 2015年 Big_Q. All rights reserved.
//

#import "XHMyCollectionViewCell.h"

@interface XHMyCollectionViewCell ()

@property(nonatomic, retain) UIImageView *pic1;
@property(nonatomic, retain) UIImageView *pic2;
@property(nonatomic, retain) UIImageView *pic3;
@property(nonatomic, retain) UILabel *label1;
@property(nonatomic, retain) UILabel *label2;
@property(nonatomic, retain) UILabel *label3;
@property(nonatomic, retain) UILabel *label4;


@end

@implementation XHMyCollectionViewCell

- (void)dealloc
{
    [_pic1 release];
    [_pic2 release];
    [_pic3 release];
    [_label1 release];
    [_label2 release];
    [_label3 release];
    [_label4 release];
    [super dealloc];
}


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.pic1 = [[UIImageView alloc] init];
        self.contentView.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:_pic1];
        [_pic1 release];
        
        self.pic2 = [[UIImageView alloc] init];
        self.contentView.backgroundColor = [UIColor lightGrayColor];
        [self.contentView addSubview:_pic2];
        [_pic2 release];
        
        self.pic3 = [[UIImageView alloc] init];
        self.contentView.backgroundColor = [UIColor lightGrayColor];
        [self.contentView addSubview:_pic3];
        [_pic3 release];
        
        self.label1 = [[UILabel alloc] init];
        self.contentView.backgroundColor = [UIColor yellowColor];
        [self.contentView addSubview:_label1];
        [_label1 release];
        
        self.label2 = [[UILabel alloc] init];
        self.contentView.backgroundColor = [UIColor blueColor];
        [self.contentView addSubview:_label2];
        [_label2 release];
        
        self.label3 = [[UILabel alloc] init];
        self.contentView.backgroundColor = [UIColor cyanColor];
        [self.contentView addSubview: _label3];
        [_label3 release];
        
        self.label4 = [[UILabel alloc] init];
        self.contentView.backgroundColor = [UIColor orangeColor];
        [self.contentView addSubview:_label4];
        [_label4 release];
    }
    return self;
}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    _pic1.frame = CGRectMake(255, 20, 100, 60);
    _label1.frame = CGRectMake(20, 20, 200, 60);
    _label2.frame = CGRectMake(20, 100, 60, 20);
    _pic2.frame = CGRectMake(215, 100, 20, 20);
    _label3.frame = CGRectMake(235, 100, 30, 20);
    _pic3.frame = CGRectMake(285, 100, 20, 20);
    _label4.frame = CGRectMake(305, 100, 50, 20);
}

- (void)setModel:(XHCollectionObject *)model
{
    if (_model != model) {
        [_model release];
        _model = [model retain];
    }
    _pic1.image = [UIImage imageNamed:model.picture1];
    _pic2.image = [UIImage imageNamed:model.picture2];
    _pic3.image = [UIImage imageNamed:model.picture3];
    _label1.text = model.lable1;
    _label2.text = model.lable2;
    _label3.text = model.lable3;
    _label4.text = model.lable4;
}




@end
